<template>
  <GdDialogContainer
    v-if="containerType === 'Dialog'"
    v-model="isShow"
    v-bind="$attrs"
  >
    <template
      v-slot:[dynamicSlotName]
      v-for="dynamicSlotName in allSlots"
      :key="dynamicSlotName"
    >
      <slot :name="dynamicSlotName"></slot>
    </template>
  </GdDialogContainer>
</template>
<script>
export default {
    inheritAttrs:false
}
</script>
<script setup>
import GdDialogContainer from "./components/dialog-container/dialog-container.vue";
import { getCurrentInstance, toRefs, watch, computed, provide } from "vue";
const props = defineProps({
  containerType: {
    type: String,
    default: "Dialog",
  },
  /**
   * 容器是否显示隐藏
   */
  modelValue: {
    type: Boolean,
  },
});
const emits = defineEmits(["update:modelValue"]);
const isShow = computed({
  get() {
    return props.modelValue;
  },
  set(value) {
    emits("update:modelValue", value);
  },
});
const { proxy: vm } = getCurrentInstance();

const allSlots = computed(() => {
  return Object.keys(vm.$slots);
});
const updateContainerVisiable = (val) => {
  emits("update:modelValue", val);
};
provide("updateContainerVisiable", updateContainerVisiable);

</script>
